<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"/>
        <title>{$xitong.webname}后台管理系统</title>
        <!-- 样 式 文 件 -->
        <link rel="stylesheet" href="/static/component/pear/css/pear.css" />
        <link rel="stylesheet" href="/static/admin/css/other/login.css" />
    </head>
    <!-- 代 码 结 构 -->
    <body style="background-size: cover;">
        <form class="layui-form" action="javascript:void(0);">
            <div class="layui-form-item">
                <img class="logo" src="/static/admin/images/logo.png" />
                <div class="title">{$xitong.webname}</div>
                <div class="desc">
                    {$xitong.webname}
                </div>
            </div>
            <div class="layui-form-item">
                <input placeholder="账 户" type="text" name="username" hover class="layui-input"/>
            </div>
            <div class="layui-form-item">
                <input placeholder="密 码" type="password" name="password"  hover class="layui-input"/>
            </div>
      
            <div class="layui-form-item">
                <input placeholder="验证码 : " type="text" maxlength="4" name="captcha" hover class="code layui-input layui-input-inline" style="width: 165px;" />
                <div style="display: inline-block;width: 155px;">
                    <img id="codeimg" class="codeImage" style="cursor: pointer;"/>
                </div>
                
            </div>
         
            <div class="layui-form-item">
                <input type="checkbox" name="remember" title="30天内自动登录" lay-skin="primary" checked>
            </div>
            <div class="layui-form-item">
                <button  class="pear-btn pear-btn-success login" lay-submit lay-filter="login">
                    登 入
                </button>
            </div>
        </form>
        <!-- 资 源 引 入 -->
        <script src="/static/component/layui/layui.js"></script>
        <script src="/static/component/pear/pear.js"></script>
        <script>
            layui.use(['form', 'layer', 'jquery', 'element'], function () {
                var $ = layui.jquery
                 , layer = layui.layer
                 , element = layui.element
                 , form = layui.form;
                // 登 录 提 交
                form.on('submit(login)', function(data) {
                    layer.load();
                    $.ajax({
                        type: "POST",
                        data: data.field,
                        success: function (res) {
                            layer.closeAll('loading');
                            if (res.code==1){
                                layer.msg(res.msg,{icon:1,time:1000},function () {
                                    location.href = '/admin/index/index';
                                })
                            } else {
                                layer.msg(res.msg,{icon:2,time:1000},function () {
                                    initCode();
                                })
                            }
                        }
                    });
                    return false;
                });
                initCode();
                function initCode() {
                    $('#codeimg').attr("src","/admin/admin/yan1?data=" + new Date().getTime());
                }
                $('#codeimg').on('click', function () {
                    initCode();
                });
            })
            </script>
    </body>
</html>
